﻿// Decompiled with JetBrains decompiler
// Type: Netick.NetickConfigData
// Assembly: Netick, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 6726ECA1-C773-4CF7-8952-E81B30D93B52
// Assembly location: D:\WorkSpaceDemo\UPM\NetickForUnity\Netick\Runtime\Netick.dll
// XML documentation location: D:\WorkSpaceDemo\UPM\NetickForUnity\Netick\Runtime\Netick.xml

using System.Numerics;

#nullable disable
namespace Netick;

/// <summary>Configuration data for Netick.</summary>
public struct NetickConfigData
{
  public int StateAllocatorBlockSize;
  public int MetaAllocatorBlockSize;
  public int MaxDataPerConnectionPerTickInBytes;
  public float TickRate;
  public int ServerDivisor;
  public int MaxPlayers;
  public int MaxObjects;
  public int MaxSnapshots;
  public int MaxPredictedTicks;
  public int MaxInterpolationSnapshots;
  public float MaxAllowedTimestep;
  public float ExtraInterpolationDelay;
  public bool AccurateLocalInterpolation;
  public bool InputReuseAtLowFPS;
  public bool BurstBuffering;
  public bool InvokeNetworkUpdate;
  public bool KickClientForBadRpc;
  public bool EnableLagCompensation;
  public bool EnableInterestManagement;
  public bool EnableNarrowphaseFiltering;
  public bool EnableSpatialPrioritization;
  public Vector3 AoIWorldSize;
  public int AoILayerCount;
  public unsafe fixed float AoICellSizes[5];
  public int CustomInterestGroupCount;

  public unsafe int GetNetworkHashCode()
  {
    int hash = 17;
    HashInt(this.StateAllocatorBlockSize);
    HashInt(this.MetaAllocatorBlockSize);
    HashInt(this.MaxDataPerConnectionPerTickInBytes);
    HashFloat(this.TickRate);
    HashInt(this.ServerDivisor);
    HashInt(this.MaxPlayers);
    HashInt(this.MaxObjects);
    HashInt(this.MaxSnapshots);
    HashInt(this.MaxPredictedTicks);
    HashInt(this.MaxInterpolationSnapshots);
    HashFloat(this.ExtraInterpolationDelay);
    HashBool(this.BurstBuffering);
    HashBool(this.EnableLagCompensation);
    HashBool(this.EnableInterestManagement);
    HashBool(this.EnableNarrowphaseFiltering);
    HashBool(this.EnableSpatialPrioritization);
    HashFloat(this.AoIWorldSize.X);
    HashFloat(this.AoIWorldSize.Y);
    HashFloat(this.AoIWorldSize.Z);
    HashInt(this.AoILayerCount);
    for (int index = 0; index < 5; ++index)
      HashFloat(this.AoICellSizes[index]);
    HashInt(this.CustomInterestGroupCount);
    return hash;

    unsafe void HashFloat(float value) => hash = hash * 31 /*0x1F*/ + *(int*) &value;

    void HashInt(int value) => hash = hash * 31 /*0x1F*/ + value;

    void HashBool(bool b) => hash = hash * 31 /*0x1F*/ + (b ? 1 : 0);
  }
}
